<?php
$params = array_merge(
    require(__DIR__ . '/../../common/config/params.php'),
    IS_LOCAL ? require(__DIR__ . '/../../common/config/params-local.php') : [],
    require(__DIR__ . '/params.php'),
    IS_LOCAL ? require(__DIR__ . '/params-local.php') : []
);

return [
    'id' => 'app-backend',
    'basePath' => dirname(__DIR__),
    'bootstrap' => ['log', 'debug'],
	'defaultRoute' => 'index',
    'controllerNamespace' => 'api\controllers',
    'components' => [
        'user' => [
            'identityClass' => 'backend\models\Admin',
            'enableAutoLogin' => true,
			'loginUrl' => ['login/index'],
        ],

        'log' => [
            'traceLevel' => YII_DEBUG ? 3 : 0,
            'targets' => [
                [
                    'class' => 'yii\log\FileTarget',
                    'levels' => ['error', 'warning'],
                ],
            ],
        ],
        'errorHandler' => [
            'errorAction' => 'site/error',
        ],
        'request' => [
            'cookieValidationKey' => 'YII2BACKEND',
        ],
        'session' => [
            'name' => 'YII2BACKSESSID',//可以自定义
            //'savePath' => __DIR__ . '/../tmp',//手工在backend目录下新建文件夹TMP
        ],
    ],
    'modules' => require(__DIR__ . '/modules.php'),
    'params' => $params,
];
